package cn.stylefeng.guns.sys.modular.system.controller;

import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
import cn.stylefeng.guns.sys.modular.system.entity.TaskStatus;
import cn.stylefeng.guns.sys.modular.system.model.params.TaskStatusParam;
import cn.stylefeng.guns.sys.modular.system.service.TaskStatusService;
import cn.stylefeng.roses.core.base.controller.BaseController;
import cn.stylefeng.roses.core.reqres.response.ResponseData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;


/**
 * 任务状态确认表控制器
 *
 * @author jiangge
 * @Date 2020-09-10 22:43:47
 */
@Controller
@RequestMapping("/taskStatus")
public class TaskStatusController extends BaseController {

    private String PREFIX = "/modular/system/taskStatus";

    @Autowired
    private TaskStatusService taskStatusService;

    /**
     * 跳转到主页面
     *
     * @author jiangge
     * @Date 2020-09-10
     */
    @RequestMapping("")
    public String index() {
        return PREFIX + "/taskStatus.html";
    }

    /**
     * 新增页面
     *
     * @author jiangge
     * @Date 2020-09-10
     */
    @RequestMapping("/add")
    public String add() {
        return PREFIX + "/taskStatus_add.html";
    }

    /**
     * 编辑页面
     *
     * @author jiangge
     * @Date 2020-09-10
     */
    @RequestMapping("/edit")
    public String edit() {
        return PREFIX + "/taskStatus_edit.html";
    }

    /**
     * 新增接口
     *
     * @author jiangge
     * @Date 2020-09-10
     */
    @RequestMapping("/addItem")
    @ResponseBody
    public ResponseData addItem(TaskStatusParam taskStatusParam) {
        this.taskStatusService.add(taskStatusParam);
        return ResponseData.success();

    }

    /**
     * 工程审核
     */
    @RequestMapping("/audit")
    @ResponseBody
    public ResponseData audit(TaskStatusParam taskStatusParam) {
        return this.taskStatusService.audit(taskStatusParam);
    }
    /**
     * 工程审核
     */
    @RequestMapping("/adminAudit")
    @ResponseBody
    public ResponseData adminAudit(TaskStatusParam taskStatusParam) {
        return this.taskStatusService.adminAudit(taskStatusParam);
    }

    /**
     * 编辑接口
     *
     * @author jiangge
     * @Date 2020-09-10
     */
    @RequestMapping("/editItem")
    @ResponseBody
    public ResponseData editItem(TaskStatusParam taskStatusParam) {
        this.taskStatusService.update(taskStatusParam);
        return ResponseData.success();
    }

    /**
     * 删除接口
     *
     * @author jiangge
     * @Date 2020-09-10
     */
    @RequestMapping("/delete")
    @ResponseBody
    public ResponseData delete(TaskStatusParam taskStatusParam) {
        this.taskStatusService.delete(taskStatusParam);
        return ResponseData.success();
    }



    /**
     * 查看详情接口
     *
     * @author jiangge
     * @Date 2020-09-10
     */
    @RequestMapping("/detail")
    @ResponseBody
    public ResponseData detail(TaskStatusParam taskStatusParam) {
        TaskStatus detail = this.taskStatusService.getById(taskStatusParam.getProId());
        return ResponseData.success(detail);
    }

    /**
     * 查询列表
     *
     * @author jiangge
     * @Date 2020-09-10
     */
    @ResponseBody
    @RequestMapping("/list")
    public LayuiPageInfo list(TaskStatusParam taskStatusParam) {
        return this.taskStatusService.findPageBySpec(taskStatusParam);
    }


    /**
     * 取消网上建店
     * @param param
     * @return
     */
    @RequestMapping(value = "/deleteWsjd")
    @ResponseBody
    public Object deleteWsjd(TaskStatusParam param) {
        this.taskStatusService.deleteWsjd(param);
        return SUCCESS_TIP;
    }

}


